<!--
function getCurrentCartDetail(lanId)
{
    DoAjax(ajaxFileURL+'?action=cart_get&lanid='+lanId,'GET',null,setCurrentCartDetail);
}
function addGoodsToCart(lanId,proId,goodsId,buyNumber,func,arg1,arg2,arg3,isGet)
{ 
    DoAjax(ajaxFileURL+'?action=cart_add&lanid='+lanId+'&proid='+proId+'&goodsid='+goodsId+'&count='+buyNumber,'GET',null,func,arg1,arg2,arg3,lanId,isGet);
}
function updateGoodsToCart(lanId,proId,goodsId,buyNumber,func,arg1,arg2,arg3)
{
    DoAjax(ajaxFileURL+'?action=cart_update&lanid='+lanId+'&proid='+proId+'&goodsid='+goodsId+'&count='+buyNumber,'GET',null,func,arg1,arg2,arg3);
}
function doActionsForAddGoodsToCart(e,lanId,proId,goodsId,count,cookieName)
{
    var e=e?e:window.event; 
    var sObj=e.srcElement ? e.srcElement : e.target;
    var x=-1;
    var y=-1;
    if(sObj!=null){
        var oop=new Op(sObj);
        x=oop.x;
        y=oop.y;
    }    
    addGoodsToCart(lanId,proId,goodsId,count,showCartMessage,cookieName,x,y,true);
}
function Op(o)
{
    var x=y=0;
    do{
        x+=o.offsetLeft;
        y+=o.offsetTop;
    }
    while (o=o.offsetParent);
    return {"x":x,"y":y};
}
function showCartCount(cookieName)
{
    var cookie=getCookie(cookieName);      
    if(cookie!=null){      
        var ct_cartCount=getCookieValue(cookie,'cartCount');  
        var ctCartCount=docEle('cartTotalCartCount');
        if(ctCartCount){
            ctCartCount.innerHTML=ct_cartCount;
        }
    }
}
function showGoodsListById(id)
{
    var obj=docEle(id);
    if(obj!=null){
        obj.style.display='block';
    }
}
function hideGoodsListById(id)
{
    var obj=docEle(id);
    if(obj!=null){
        obj.style.display='none';
    }
}
function setCurrentCartDetail(xmlHttp)
{   
    var xmlDoc=xmlHttp.responseXML || xmlHttp.responseXML.documentElement;
    if(xmlDoc!=null)
    {          
        var cartDetail=xmlDoc.getElementsByTagName("JCart");  
        if(cartDetail!=null && cartDetail.length==1)
        {
            setHTML('showCartListDiv',getNodeValue(xmlDoc,"Detail"));
            setHTML('showCartTotalNumber',getNodeValue(xmlDoc,"TotalNumber"));
            setHTML('showCartTotalMoney',getNodeValue(xmlDoc,"TotalMoney"));
        }
    }
}
function showCartMessage(xmlHttp,cookieName,left,top,lanId,isGet)
{
    var cookie=getCookie(cookieName);      
    if(cookie!=null){   
        var ct_sign=getCookieValue(cookie,'sign');
        var ct_state=getCookieValue(cookie,'state');
        var ct_msg=getCookieValue(cookie,'msg');
        var ct_cartCount=getCookieValue(cookie,'cartCount');        
        var ct_goodsCount=getCookieValue(cookie,'goodsCount');
        var ct_totalMoney=getCookieValue(cookie,'totalMoney');
        var sobj=docEle('cart_successMsg');
        var eobj=docEle('cart_errorMsg');
        var ctCartCount=docEle('cartTotalCartCount');         
        if(ctCartCount){
            ctCartCount.innerHTML=ct_cartCount;
        }        
        if(ct_state!=null && ct_state==1){
            if(sobj){               
                sobj.style.left=(left-150+'').replace(/px/gi,'')+'px';                
                sobj.style.top=(top+'').replace(/px/gi,'')+'px';              
                sobj.style.display='';
                if(docEle('cart_totalCartCount') && ct_cartCount!=null){
                    docEle('cart_totalCartCount').innerHTML=ct_cartCount;
                }
                if(docEle('cart_totalGoodsCount') && ct_goodsCount!=null){
                    docEle('cart_totalGoodsCount').innerHTML=ct_goodsCount;
                }             
                if(docEle('cart_totalGoodsMoney') && ct_totalMoney!=null){
                    docEle('cart_totalGoodsMoney').innerHTML=(ct_sign!=null?ct_sign+'':'')+ ct_totalMoney;
                }
                checkIsHideMsg('cart_successMsg');
            }
            if(eobj){
                eobj.style.display='none';
            }
            isGet=isGet||false;
            lanId=lanId||'0';
            if(isGet){
                getCurrentCartDetail(lanId);
            }
        }else if(ct_state!=null && ct_state==0){            
            if(eobj){
                eobj.style.left=(left-150+'').replace(/px/gi,'')+'px';
                eobj.style.top=(top+'').replace(/px/gi,'')+'px';               
                eobj.style.display='';
                if(docEle('cart_errorContent') && ct_msg!=null){
                    docEle('cart_errorContent').innerHTML=ct_msg;
                }  
                checkIsHideMsg('cart_errorMsg');
            }
            if(sobj){
                sobj.style.display='none';
            }
        }else{
            sobj.style.display='none';
            eobj.style.display='none';
        }              
    }
}
function checkIsHideMsg(id)
{
    document.body.onclick=function(e){
        var targ=null;
        if (!e){
            var e = window.event;
        }
        if (e.target){
            targ = e.target;
        }else if (e.srcElement){
            targ = e.srcElement;
        }                   
        if (targ!=null && targ.nodeType == 3){ 
           targ = targ.parentNode;
        }    
        var targId=targ!=null ? targ.id:''; 
        var isOn=false;
        while(targ!=null){
            if(targId!='' && targId==id){
                isOn=true;
                break;
            }else{
                targ=targ.parentNode;
                targId=targ!=null?targ.id:'';            
            }            
        }
        if(!isOn){
            if(docEle(id)&&docEle(id).style.display!='none'){
                docEle(id).style.display='none';
            }
        }
    }
}
function closeCartMsg(id)
{
     if(docEle(id)){
        docEle(id).style.display='none';
     }
}
function formatMoney(money,sign){
    var moneyStr=''+money; 
    if(moneyStr.indexOf('.')<0){    
        moneyStr=moneyStr+'.00'; 
    }else if(moneyStr.indexOf('.')==moneyStr.length-1){
        moneyStr=moneyStr+'00';    
    }else if(moneyStr.indexOf('.')==moneyStr.length-2){
        moneyStr=moneyStr+'0';    
    }else if(moneyStr.indexOf('.')<moneyStr.length-3){ 
        moneyStr=''+(money+0.005);
        moneyStr=moneyStr.substr(0,moneyStr.indexOf('.')+3);  
    }
    return sign+moneyStr;
}
var isLoadCss=false;
function addCartCssStyle() { 
    if(!isLoadCss){
        var fileref=document.createElement("link");
        fileref.setAttribute("rel", "stylesheet");
        fileref.setAttribute("type", "text/css");
        fileref.setAttribute("href", '/CustomAction/goods/css/cart.css');
        if(document.getElementsByTagName("head")){
            document.getElementsByTagName("head")[0].appendChild(fileref);
            isLoadCss=true;
        }else if(document.getElementsByTagName("body")){
            document.getElementsByTagName("body")[0].appendChild(fileref);
            isLoadCss=true;
        }
    }
}
addCartCssStyle();
-->